Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: no strict dep5 parsing #805

Closed
wants to merge 6 commits into from
Closed

Conversation

nicorikken
Copy link
Member

Since version 0.1.47 of python-debian the dep5 parsing is strict. This is causing issues for certain users that have multiple Copyright statements in their Dep5 file. Disablng strictness removes the issue for those users.

Closes #803

Since version 0.1.47 of python-debian the dep5 parsing is strict. This is
causing issues for certain users that have multiple Copyright statements in
their Dep5 file. Disablng strictness removes the issue for those users.

Closes #803

Signed-off-by: Nico Rikken <[email protected]>
@carmenbianca carmenbianca self-requested a review July 19, 2023 19:30
Copy link
Member

@carmenbianca carmenbianca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is missing a test. The test can be as simple as 'does not raise an error when trying to parse a (slightly? very?) incorrect DEP5 file'.

Tests to ensure that all Copyright information from the .reuse/dep5 file is taken
into account. It contains 2 testcases, for both strictly and non-strictly
formatted dep5 files. The latter being present in the wild, based on comments in #803

Signed-off-by: Nico Rikken <[email protected]>
@nicorikken
Copy link
Member Author

This fails in its current state as multiple copyright fields are simply ignored.

Generating a file-report with a non-strict dep5 containing multiple Copyright
entries will leave part of the Copyright information to be ignored. The updated
test reflects that behavior and now no longer fails.

Signed-off-by: Nico Rikken <[email protected]>
@nicorikken nicorikken marked this pull request as ready for review July 21, 2023 17:36
nicorikken and others added 3 commits July 21, 2023 19:44
Update line wrap length and disable pylint for the dep5 file content.

Signed-off-by: Nico Rikken <[email protected]>
I found this while working on something else. Tiny commit; why not.
@carmenbianca carmenbianca self-requested a review July 22, 2023 17:22
Copy link
Member

@carmenbianca carmenbianca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've adjusted the tests a little. No functional changes; just refactored to no longer call to_dict_lint.

@carmenbianca carmenbianca self-requested a review July 23, 2023 09:24
@carmenbianca
Copy link
Member

I am no longer certain if I want to merge this.

I took a look at python-debian 0.1.38 (the lowest compatible version according to pyproject.toml), and strict mode was always enabled.

https://salsa.debian.org/python-debian-team/python-debian/-/blob/0.1.38/lib/debian/copyright.py#L130

I have to assume that python-debian recently included 'no duplicate fields' in their checks, which is fine, but simply disabling this now results in other breakage.

Specifically, the following checks (in 0.1.38, but I'm going to assume that they exist after 0.1.38 also):

                    _complain('Non-header paragraph has neither "Files" nor '
                              '"License" fields', strict)

[...]

            if 'Copyright' not in data:
                _complain('Files paragraph missing Copyright field', strict)
            if 'License' not in data:
                _complain('Files paragraph missing License field', strict)

            if not self.files:
                _complain('Files paragraph has empty Files field', strict)

I am fairly certain that we do need/want these checks.

@nicorikken
Copy link
Member Author

nicorikken commented Jul 24, 2023

@carmenbianca Good catch, then downgrading python-debian seems more appropriate.

@nicorikken nicorikken closed this Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dep5 Duplicate field "Copyright": Fails to parse many files with REUSE v2.1.0 Release
2 participants